import {BasePage, BaseColumn} from "../../../ts/type";
import {replace, stampToDatetimeText} from "../../../ts/util";
import {h} from "vue";

export let entityColumnInit = (page: BasePage) => {
    page.columns.push(replace(new BaseColumn('index', ''), {
        width: 60
    }))
    page.columns.push(replace(new BaseColumn('id', 'ID'), {
        sorter: 'default',
        defaultSortOrder: 'descend',
        width: 80
    }))
// field column auto
// #bind.field.tableName#
    page.columns.push(new BaseColumn('tableName', '表名'))
// $bind.field.tableName$

// #bind.field.prefix#
    page.columns.push(new BaseColumn('prefix', '表前缀'))
// $bind.field.prefix$

// #bind.field.className#
    page.columns.push(new BaseColumn('className', '类名'))
// $bind.field.className$

// #bind.field.module#
    page.columns.push(new BaseColumn('module', '模块'))
// $bind.field.module$

// #bind.field.pack#
    page.columns.push(new BaseColumn('pack', '包名'))
// $bind.field.pack$

// #bind.field.path#
    page.columns.push(new BaseColumn('path', '相对路径'))
// $bind.field.path$

// #bind.field.remark#
    page.columns.push(new BaseColumn('remark', '备注'))
// $bind.field.remark$

// #bind.field.tableCode#
    page.columns.push(new BaseColumn('tableCode', '实体编码'))
// $bind.field.tableCode$

// field label auto
    page.columns.push(new BaseColumn('createBy', '创建人'))
    page.columns.push(new BaseColumn('updateBy', '修改人'))
    page.columns.push(replace(new BaseColumn('createTime', '创建时间'), {
        render: (row: any) => {
            return h('span', stampToDatetimeText(row.createTime))
        }
    }))
    page.columns.push(replace(new BaseColumn('updateTime', '修改时间'), {
        render: (row: any) => {
            return h('span', stampToDatetimeText(row.updateTime))
        }
    }))
}